<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title></title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script src="https://unpkg.com/vue-router/dist/vue-router.js"></script>
</head>

<body>
    <div id='app'>
        <router-view name="index"></router-view>
        <router-view name="side"></router-view>
        <router-view></router-view>
    </div>
    <script>
        const index = {
            template: '<div>首页</div>'
        }

        const side = {
            template: `<div>侧边栏</div>`
        }

        const body = {
            template: `<div>默认的路由</div>`
        }

        const router = new VueRouter({
            routes: [{
                path: '/index',
                components: {
                    // key 路由对应组件的名字
                    // index,
                    side,
                    default:body
                }
            }]
        })
        const vm = new Vue({
            el: '#app',
            data: {},
            router
        })
    </script>
</body>

</html>